import os

# import openpyxl


def search_file(file_list, meta_data):
    for i in file_list:
        if i[-3:]=="npy":
            data = i.split("_")
            if data[0][-3:] == meta_data and data[1] == "up":
                return i
    return None


# def modify_label_message(label_file, files_root, meta_col, new_file_column):
#     files = os.listdir(files_root)
#     data = openpyxl.load_workbook(label_file)
#     stn = data.sheetnames[0]
#     table = data.get_sheet_by_name(stn)
#     table = data.active
#     nrows = table.max_row
#     for i in range(1, nrows + 1):
#         result = search_file(files, str(table.cell(i, meta_col).value))
#         if not result is None:
#             table.cell(i, new_file_column).value = result
#     data.save(label_file)
